package br.unifor.cct.mia.runner;

import java.util.ArrayList;
import java.util.Date;

import br.unifor.cct.mia.coevolution.CoevolutionaryDomain;
import br.unifor.cct.mia.coevolution.InvalidTypeException;
import br.unifor.cct.mia.dataenhancement.Database;
import br.unifor.cct.mia.dataenhancement.Structure;
import br.unifor.cct.mia.evaluate.Evaluate;
import br.unifor.cct.mia.ga.Ga;
import br.unifor.cct.mia.ga.coevolutionary.RepCoevGaFS;
import br.unifor.cct.mia.util.LoadFile;

public class RepetableCoevolutionaryFS {

	public static String BASE_NAME = "zoo";
	public static String DATASET_STRUCTURE = "./data/"+BASE_NAME+"_estrutura.txt";
	public static String DATASET_DATA = "./dataPart/"+BASE_NAME+"_TRAIN_data.txt";
	public static String DATASET_TESTE = "./dataPart/"+BASE_NAME+"_TEST_data.txt";
	
	public static int SPECIE_SIZE = 2;
	public static Integer learnerType = Evaluate.J48;
	
	public static void main(String[] args) {

		Structure st = LoadFile.loadStructure(DATASET_STRUCTURE);
    	Database db = LoadFile.loadDatabase(DATASET_DATA);
		System.out.println("Arquivos carregados com sucesso");
		
		try {
			System.out.println(new Date());
			CoevolutionaryDomain domain = new CoevolutionaryDomain(CoevolutionaryDomain.REPEATABLE_MEMORY,learnerType);
			
			/* FEATURE SELECTION */
			int attSize = st.size()-1;
			int indivSize = attSize/SPECIE_SIZE;
			
            			
			Ga gaFs1 = new RepCoevGaFS(db,st,domain,indivSize,0,null);
			Ga gaFs2 = new RepCoevGaFS(db,st,domain,indivSize,1,null);
			
			ArrayList species =  new ArrayList();	
			species.add(gaFs1);
			species.add(gaFs2);			
			
			domain.setSpecies(species);
			domain.start();			
			
			
		} catch (InvalidTypeException e) {
			e.printStackTrace();
		} catch (Exception e) {			
			e.printStackTrace();
		}
		
	}

}
